// 1. 抽象类UserTest及子类
public abstract class UserTest
{
    public abstract void M1();
    public abstract void M2();
    public abstract void M3();
}

public class UserTestImpl : UserTest
{
    public override void M1() => Console.WriteLine("子类实现M1方法");
    public override void M2() => Console.WriteLine("子类实现M2方法");
    public override void M3() => Console.WriteLine("子类实现M3方法");
}


// 2. 接口IUserService及实现类
public interface IUserService
{
    void Add();
    void Delete();
    void Update();
    void Query();
}

public class UserServiceImpl : IUserService
{
    public void Add() => Console.WriteLine("执行增加操作");
    public void Delete() => Console.WriteLine("执行删除操作");
    public void Update() => Console.WriteLine("执行修改操作");
    public void Query() => Console.WriteLine("执行查询操作");
}


// 3. 上课练习类（Student、Father、Child、Son）
public class Student
{
    public virtual void Study() => Console.WriteLine("学生学习");
}

public class Father
{
    public virtual void Work() => Console.WriteLine("父亲工作");
}

public class Child : Father
{
    public override void Work() => Console.WriteLine("孩子暂时不工作");
    public void Play() => Console.WriteLine("孩子玩耍");
}

public class Son : Child
{
    public override void Work() => Console.WriteLine("儿子长大后开始工作");
}


// Demo类（封装所有执行逻辑）
public class Demo
{
    // 封装测试方法
    public static void RunAllTests()
    {
        // 测试抽象类子类
        Console.WriteLine("=== 测试抽象类 ===");
        UserTestImpl userTest = new UserTestImpl();
        userTest.M1();
        userTest.M2();
        userTest.M3();

        // 测试接口实现类
        Console.WriteLine("\n=== 测试接口 ===");
        IUserService userService = new UserServiceImpl();
        userService.Add();
        userService.Delete();
        userService.Update();
        userService.Query();

        // 测试上课练习类
        Console.WriteLine("\n=== 测试练习类 ===");
        Student stu = new Student();
        stu.Study();

        Father father = new Father();
        father.Work();

        Child child = new Child();
        child.Work();
        child.Play();

        Son son = new Son();
        son.Work();
    }
}